<template>
    <div class="notic-bar">
        <img src="../../../static/xtgg.png" class="notice-img" />
        <div class="notice-bar-container">
            <div class="notice-bar__wrap">
                <div v-for="(item, index) in list" :key="index" class="notice-bar__wrap_text">
                    {{ item }}
                </div>
            </div>
        </div>
    </div>
</template>
  
<script>
export default {
    data() {
        return {
            list: [
				"1. 欢迎使用本系统",
				"",
				"2. 欢迎使用本系统",
				"",
				"3. 欢迎使用本系统",
			]
        }
    },
	mounted() {
		/* 系统公告接口 */
		uni.request({
			url: this.$serverUrl + '/apiNotice/list',
			method: 'GET',
			header: {
				'token': uni.getStorageSync('token')
			},
			success: (res) => {
				if (res.data.data.length > 0) {
					this.list = []
					res.data.data.forEach((item, index) => {
						this.list.push(index + 1 + '.' + item.content)
					})
				} 
			}
		});
	}
}
</script>
  
<style scoped>
.notic-bar {
    display: flex;
    background: #b88e9c;
    margin: 5px;
    border-radius: 5px;
    padding: 2px 5px;
}

.notice-bar-container {
    display: flex;
    width: calc(100% - 30px);
    height: 20px;
    overflow: hidden;
    margin-left: 5px;
}

.notice-img {
    width: 20px;
    height: 20px;
}

.notice-bar__wrap {
    margin-left: 10px;
    display: flex;
    animation: move 40s linear infinite;
    line-height: 20px;
    color: #f5f6f7;
}
.notice-bar__wrap_text {
        width: max-content;
        min-width: 100px;
    }

@keyframes move {
    0% {
        transform: translateX(0%);
    }
	
	25% {
	    transform: translateX(-20%);
	}
	
	50% {
	    transform: translateX(-50%);
	}
	
	75% {
	    transform: translateX(-75%);
	}

    100% {
        transform: translateX(-100%);
    }
}
</style>
  